from pydantic import BaseSettings
from typing import List


class Settings(BaseSettings):
    # Server Configuration
    host: str = "0.0.0.0"
    port: int = 8000
    debug: bool = True
    
    # Database
    database_url: str = "sqlite+aiosqlite:///./data/contracts.db"
    
    # Proxy Configuration
    proxy_host: str = "127.0.0.1"
    proxy_port: int = 7890
    
    # Binance WebSocket
    binance_ws_base_url: str = "wss://nbstream.binance.com/eoptions/ws"
    
    # Trading Pairs
    supported_symbols: str = "ETHUSDT,BTCUSDT"
    
    # Contract Settings
    initial_balance: float = 10000.0
    profit_rate_10m: float = 0.8
    profit_rate_other: float = 0.85
    
    # WebSocket Settings
    ping_interval: int = 300  # 5 minutes
    pong_timeout: int = 900   # 15 minutes
    
    class Config:
        env_file = ".env"
    
    @property
    def symbols_list(self) -> List[str]:
        return [s.strip() for s in self.supported_symbols.split(",")]
    
    @property
    def proxy_url(self) -> str:
        return f"http://{self.proxy_host}:{self.proxy_port}"


settings = Settings()
